<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="statics/js/jquery-3.6.0.min.js"></script>
    <title>bootstrap起步</title>
    <script>
        $(document).ready(function () {
            $('#btn').click(function () {
                $.post({
                    url: "a1",
                    data: {'name': $("#name").val()},
                    success: function (data, status) {
                        alert('data ' + data);
                        alert('status ' + status);
                    }
                });
            });

            $('#btn1').click(function () {
                $.get({
                    url: "a2",
                    data: null,
                    success: function (data, status) {
                        alert(data[0]['name']);
                    }
                });
            });
        });
    </script>
</head>
<body>
<form>
    <label for="name"></label><input id="name" name="name" type="text">
    <input id="btn" type="button" value="ajax">
    <input id="btn1" type="button" value="json">
</form>
</body>
</html>